<script>

$(window).ready(function () {
    var footer = $(".bottom");
    var win = $(window);
    var sc = $(document);
    // console.log(win.height());
    // console.log(footer.height());

    footer.addClass("fixedfooter");
    if (sc.height()- win.height() > 0) {
        footer.removeClass("fixedfooter");
    }else if(sc.height()- win.height() == 0){
        footer.addClass("fixedfooter");
    }
    win.resize(function() {
       // console.log(win.height());
        // console.log("sc:"+sc.height());
        // console.log("footer:"+ footer.offset().top);
        // console.log("结果："+(sc.height()- footer.height() - footer.offset().top));
        if(footer.hasClass("fixedfooter")){
            //console.log("有");
            if (sc.height() -(footer.height()+ footer.offset().top) <= 0){
                if(!footer.hasClass("fixedfooter")){
                    footer.addClass("fixedfooter");
                }
            }else{
                footer.removeClass("fixedfooter");
            }
        }else{
            if (sc.height() -(footer.height()+ footer.offset().top) >= 0){
                footer.addClass("fixedfooter");
            }else{
                if(footer.hasClass("fixedfooter")) {
                    footer.removeClass("fixedfooter");
                }
            }
        }

    });
})

	</script>

